<?php $this->pageTitle = 'GIRO Export'; ?>
<?php
$this->breadcrumbs = array(
	'Payment Vouchers' => array('paymentVoucher/index'),
	'GIRO Export'
);
?>
<div class="main-title">
	<h1>GIRO Export</h1>
</div>
<div class="flat_area grid_16">
	<?php if ($isAgencyBankInfoMissing): ?>
		<div class="section highlighted">
			<div class="block">
				<h2>
					<img src="/images/icons/farmfresh/32x32/error.png" />
					Agency Bank Account Information Required
				</h2>
				<p>Bank information of the agency needs to be entered before the export to GIRO function can be used.</p>
				<div>
					<a class="link-button with-icon green no-margin" href="<?php echo $this->createUrl('/manage/system/update'); ?>"><img src="/images/icons/fugue/pencil.png" />Update Agency Bank Information</a>
				</div>
			</div>
		</div>
	<?php endif; ?>
	<?php if ($totalCount2 > 0): ?>
		<div class="section highlighted">
			<div class="block">
				<h2>Records with insufficient bank information</h2>
				<?php
				$this->widget('PsGridView', array(
					'id' => 'payment-voucher-index-grid-2',
					'dataProvider' => $dataProvider2,
					'template' => '{pager}{items}{pager}',
					'emptyText' => $emptyText,
					'htmlOptions' => array(
						'class' => 'grid-view grey'
					),
					'pagerCssClass' => 'pager',
					'pagesizeCssClass' => 'pager-pagesize float-right',
					'rowCssClassExpression' => '($data->deleted == 1 ? "deleted" : "")',
					'columns' => array(
						'index' => array(
							'header' => '#',
							'value' => '$row + 1',
							'headerHtmlOptions' => array('class' => 'align-right'),
							'htmlOptions' => array('class' => 'align-right')
						),
						'id' => array(
							'header' => 'Payee',
							'type' => 'raw',
							'value' => 'CHtml::link($data["name"], array("/manage/users", "id" => $data["id"]), array("class" => "blue link"))'
						),
						'bank_account_name' => array(
							'header' => 'Bank Account Name',
							'type' => 'raw',
							'value' => '$data["bank_account_name"] ? $data["bank_account_name"] : "<strong>(Not specified)</strong>"'
						),
						'bank_account_no' => array(
							'header' => 'Bank Account No',
							'type' => 'raw',
							'value' => '$data["bank_account_no"] ? $data["bank_account_no"] : "<strong>(Not specified)</strong>"'
						),
						'bank_code' => array(
							'header' => 'Bank Code',
							'type' => 'raw',
							'value' => '$data["bank_code"] ? $data["bank_code"] : "<strong>(Not specified)</strong>"'
						),
						'bank_branch_code' => array(
							'header' => 'Branch Code',
							'type' => 'raw',
							'value' => '$data["bank_branch_code"] ? $data["bank_branch_code"] : "<strong>(Not specified)</strong>"'
						),
						'actions' => array(
							'header' => 'Actions',
							'type' => 'raw',
							'value' => 'CHtml::link("Edit Bank Info", array("/manage/users/bankinfo", "id" => $data["id"]), array("class" => "blue link", "target" => "_blank"))'
						),
					)
				));
				?>
			</div>
		</div>
	<?php endif; ?>
	<div class="section">
		<div class="block">
			<h2>Export Preview</h2>
			<?php
			$this->widget('PsGridView', array(
				'id' => 'payment-voucher-index-grid',
				'dataProvider' => $dataProvider,
				'template' => '{pager}{items}{pager}',
				'emptyText' => $emptyText,
				'htmlOptions' => array(
					'class' => 'grid-view grey'
				),
				'pagerCssClass' => 'pager',
				'pagesizeCssClass' => 'pager-pagesize float-right',
				'rowCssClassExpression' => '($data->deleted == 1 ? "deleted" : "")',
				'columns' => array(
					'index' => array(
						'header' => '#',
						'value' => '$row + 1',
						'headerHtmlOptions' => array('class' => 'align-right'),
						'htmlOptions' => array('class' => 'align-right')
					),
					'id' => array(
						'header' => 'Payee',
						'type' => 'raw',
						'value' => 'CHtml::link($data["name"], array("/manage/users", "id" => $data["id"]), array("class" => "blue link"))'
					),
					'bank_account_name' => array(
						'header' => 'Bank Account Name',
						'type' => 'raw',
						'value' => '$data["bank_account_name"] ? $data["bank_account_name"] : "<strong>(Not specified)</strong>"'
					),
					'bank_account_no' => array(
						'header' => 'Bank Account No',
						'type' => 'raw',
						'value' => '$data["bank_account_no"] ? $data["bank_account_no"] : "<strong>(Not specified)</strong>"'
					),
					'bank_code' => array(
						'header' => 'Bank Code',
						'type' => 'raw',
						'value' => '$data["bank_code"] ? $data["bank_code"] : "<strong>(Not specified)</strong>"'
					),
					'bank_branch_code' => array(
						'header' => 'Branch Code',
						'type' => 'raw',
						'value' => '$data["bank_branch_code"] ? $data["bank_branch_code"] : "<strong>(Not specified)</strong>"'
					),
					'actions' => array(
						'header' => 'Actions',
						'type' => 'raw',
						'value' => 'CHtml::link("Edit Bank Info", array("/manage/users/bankinfo", "id" => $data["id"]), array("class" => "blue link", "target" => "_blank"))'
					),
				)
			));
			?>
			<?php
			$form = $this->beginWidget('GxActiveForm', array(
				'id' => 'export-action-form',
				'method' => 'get'
			));
			?>
			<div id="bulk-actions-form">
				<h2>Export Settings</h2>
				<table class="form-table">
					<tr>
						<th scope="row" width="100" class="align-right">
							Export for Bank:
						</th>
						<td>
							<?php
							echo CHtml::dropDownList('target_bank', '', array(
//								'DBS' => 'DBS',
								'OCBC' => 'OCBC'
							));
							?>
						</td>
					</tr>
				</table>
				<?php echo GxHtml::submitButton(Yii::t('app', 'Export'), array('class' => 'blue link-button no-margin', 'name' => 'action', 'disabled' => $isAgencyBankInfoMissing)); ?>
			</div>
			<?php $this->endWidget(); ?>
		</div>
	</div>
</div>

